import { _decorator, Component, instantiate, Node, Prefab, TiledLayer } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('MapLayer')
export class MapLayer extends Component {
    @property({ type: TiledLayer})
    public tiledLayer: TiledLayer | null = null;

    @property({type: Prefab})
    public PlayerPrefab: Prefab | null = null;
    
    
    
    start() {
        this.initScene(this.PlayerPrefab!);
    }

    initScene(prefab: Prefab){
        const playerNode = instantiate(prefab);
        playerNode.setPosition(0 , 0);
        this.tiledLayer!.addUserNode(playerNode);
    }
}


